/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2024-11-21
 * Time: 16:35
 */
public class test2 {
    /*
    LeetCode 495 提莫攻击
       返回秒数
     */

    public int findPoisonedDuration(int[] nums, int duration) {
        int ret =0;
        for(int i=0;i<nums.length-1;i++){
            if(nums[i+1]-nums[i]>duration){
                ret +=duration;
            }else{
                ret += nums[i+1]-nums[i];
            }
        }
        ret+=duration;
        return ret;
    }
}
